#Include <ScreenCapture.au3>
#Include <File.au3>
#Include <Function For PageViewer.au3>
#Include <GuiListView.au3>
#include <Date.au3>

If $bPageViewType <> 1 Then Exit 
$sLogFileName1 = 'PageViewerFormatTraverseSaveAs2'
Common_WriteCurrentFunctionNameToTempTXT($sLogFileName1)
#cs
SaveAs_DOC_To_()
SaveAs_DOCX_To_()
SaveAs_DOCM_To_()
SaveAs_RTF_To_()
SaveAs_XLS_To_()
SaveAs_XLSX_To_()
SaveAs_XLSM_To_()
SaveAs_PPT_To_()
SaveAs_PPTX_To_()
SaveAs_PPTM_To_()
SaveAs_PPS_To_()
SaveAs_PPSX_To_()
SaveAs_PPSM_To_()
SaveAs_TXT_To_()
SaveAs_XML_To_()
#ce
DocumentSaveAs()
Func DocumentSaveAs()
	Local  $hPMHandle = '', $hThumbnailView = ''
	Common_Del_DB()
	Common_InitializeStatus()
	InitializeStatusForPageViewer()
	If Assign('hPMHandle', Common_Run_PageManager_Ex('DocumentSaveAs', $sLogFileName1)) And $hPMHandle == '' Then Return False
	If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, 'DocumentSaveAs', $sLogFileName1)	Then Return False
	If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, 'DocumentSaveAs', $sLogFileName1)) And $hThumbnailView == '' Then Return False	
	For $i = 0 to 13	
		Local $TestCaseID = "DOC_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOC.doc', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'DOC.doc')
	Next

	For $i = 0 to 13	
		Local $TestCaseID = "DOCX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOCX.docx', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'DOCX.docx')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "DOCM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOCM.docm', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'DOCM.docm')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "RTF_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'RTF.rtf', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'RTF.rtf')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "XLS_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLS.xls', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'XLS.xls')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "XLSX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLSX.xlsx', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'XLSX.xlsx')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "XLSM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLSM.xlsm', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'XLSM.xlsm')
	Next
	
	For $i = 0 to 13	
		Local $TestCaseID = "PPT_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPT.ppt', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPT.ppt')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "PPTX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPTX.pptx', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPTX.pptx')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "PPTM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPTM.pptm', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPTM.pptm')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "PPS_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPS.pps', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPS.pps')
	Next
	
	For $i = 0 to 13	
		Local $TestCaseID = "PPSX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPSX.ppsx', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPSX.ppsx')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "PPSM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPSM.ppsm', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'PPSM.ppsm')
	Next
	
	For $i = 0 to 13
		Local $TestCaseID = "TXT_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TXT.TXT', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'TXT.TXT')
	Next
	
	For $i = 0 to 13	
		Local $TestCaseID = "XML_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XML.xml', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		Common_SleepInSeconds(4)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'XML.xml')
	Next
	Common_Close_PM($hPMHandle)	
EndFunc

Func SaveAs_DOC_To_()
	For $i = 0 to 13
		Local $TestCaseID = "DOC_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOC.doc', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)		
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(1)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_DOCX_To_()
	For $i = 0 to 13
		Local $TestCaseID = "DOCX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOCX.docx', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_DOCM_To_()
	For $i = 0 to 13
		Local $TestCaseID = "DOCM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'DOCM.docm', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_RTF_To_()
	For $i = 0 to 13
		Local $TestCaseID = "RTF_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'RTF.rtf', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_XLS_To_()
	For $i = 0 to 13
		Local $TestCaseID = "XLS_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLS.xls', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_XLSX_To_()
	For $i = 0 to 13
		Local $TestCaseID = "XLSX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLSX.xlsx', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_XLSM_To_()
	For $i = 0 to 13
		Local $TestCaseID = "XLSM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XLSM.xlsm', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_PPT_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPT_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPT.ppt', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_PPTX_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPTX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPTX.pptx', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_PPTM_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPTM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPTM.pptm', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_PPS_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPS_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPS.pps', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_PPSX_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPSX_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPSX.ppsx', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc
 
Func SaveAs_PPSM_To_()
	For $i = 0 to 13
		Local $TestCaseID = "PPSM_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'PPSM.ppsm', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_TXT_To_()
	For $i = 0 to 13
		Local $TestCaseID = "TXT_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TXT.TXT', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_XML_To_()
	For $i = 0 to 13
		Local $TestCaseID = "XML_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'XML.xml', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		Common_SleepInSeconds(1)	
		WinActivate($hPMHandle)
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		Common_SleepInSeconds(5)	
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc





